﻿using System;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace DjangoRESTFrameworkDAL.REST
{
    public interface IDelete
    {
        string Url { get; }
    }


    public static class DeleteEx
    {
        /// <summary>
        ///     获取详细内容
        /// </summary>
        /// <typeparam name="T">序列化数据模型类型</typeparam>
        /// <param name="dal">DAL实例化对象</param>
        /// <returns>返回实例对象</returns>
        public static async Task<bool> DeleteAsync<T>(this T dal) where T: IDelete
        {
            var response = await RestHttpClient.Instance.DeleteWithPolicyAsync(dal.Url);
            return response.IsSuccessStatusCode;
        }
    }
}